home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.4 KB | 60 lines | [TEXT/GEOL] |
- Item 4063007 31-Oct-90 08:20PST
-
- From: PHAROS.TECH Pharos Tech, Tech Staff,PRT
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: BlockSet
-
- From: Schmitz, Scott D. on Wed, Oct 31, 1990 11:19 AM
- Subject: BlockSet
- To: MacApp
-
- Below is a slightly improved version of BlockSet. This version uses longword
- assignment when it can. This should increase the speed.
-
- Procedure BlockSet (destPtr: Ptr;
- byteCount: longint;
- setVal: Univ SignedByte);
-
- Var
- endPtr: Ptr;
- LongSetVal: longint;
- safeEndPtr: Ptr;
-
- Begin
- destPtr := Ptr(StripLong(destPtr));
- endPtr := Ptr(Ord(destPtr) + byteCount);
- safeEndPtr := Ptr(Ord(destPtr) + BAND(bytecount, $FFFFFFFC)); {Trunc to
- nearest 4 bytes}
-
- {Lets get a 4 byte 'punch'. If the compiler is worth anything it will place
- this in a register}
- ResType(LongSetVal)[1] := Chr(setVal);
- ResType(LongSetVal)[2] := Chr(setVal);
- ResType(LongSetVal)[3] := Chr(setVal);
- ResType(LongSetVal)[4] := Chr(setVal);
-
- {Assign in 4 byte chunks what we can}
- While Ord(destPtr) < Ord(safeEndPtr) Do
- Begin
- LongIntPtr(destPtr)^ := LongSetVal;
- destPtr := Ptr(Ord(destPtr) + 4);
- End;
-
- {Now finish assigning odd bytes}
- While Ord(destPtr) < Ord(endPtr) Do
- Begin
- destPtr^ := setVal;
- destPtr := Ptr(Ord(destPtr) + 1);
- End;
-
- End;
-
-
-
- Scott Schmitz
- Pharos
-
-
-